{template common/contentheader}
<div class="setcontent">
	<div class="settitle">
		<h3>{lang admin_content_category:admin}</h3>
	</div>
	<div class="alert alert-info mt10">
		<span class="label label-info">{lang info:admin}</span>
		{lang admin_content_category_tip:admin}
	</div>
	<div class="setform">
		<table class="table table-striped">
        <thead>
          <tr>
            <th width="30">ID</th>
            <th width="50">{lang th_displayorder:admin}</th>
            <th width="80">{lang category_name_cn:admin}</th>
            <th width="80">{lang category_name_en:admin}</th>
            <th width="80">{lang parent_category:admin}</th>
            <th width="50">{lang category_is_open:admin}</th>
            <th width="50">{lang category_is_home:admin}</th>
            <th width="200">{lang category_hot_words:admin}</th>
            <th width="80">{lang operation:admin}</th>
          </tr> 
        </thead>
        <tbody>
        {loop $categories $key $sm}
			<tr>  
			<td>$sm['category_id']</td>
			<td>$sm['display_order']</td>
			<td>$sm['category_name_cn'] <img alt="" src="{baseurl}data/attachments/category/{$sm['category_id']}_cat.jpg" width="20" height="20" onerror="javascript:this.src = '{baseurl}assets/img/blank.png';"></td>
			<td>$sm['category_name_en']</td>
			<td>{if !$sm['parent_name']}{lang no_parent:admin}{else}$sm['parent_name']{/if}</td>
			<td>{if $sm['is_open']}{lang yes:admin}{else}{lang no:admin}{/if}</td>
            <td>{if $sm['is_home']}{lang yes:admin}{else}{lang no:admin}{/if}</td>
			<td>$sm['category_hot_words']</td>
			<td>{if !$sm['is_system']}<a href="{url admin/contentcategory?act=delete&catid=$sm['category_id']}">{lang delete:admin}{/if}</a> 
			<a href="{url admin/contentcategory?act=edit&catid=$sm['category_id']}">{lang edit:admin}</a></td>
          	</tr>
		{/loop}
          
        </tbody>
		</table>
		<div class="text_c">$pages</div>
	</div>
	<div class="settitle">
		<h3>{lang add_category:admin}</h3>
	</div>
	<div class="setform">
		<form class="pzform" method="post" action="{url admin/contentcategory?act=add}" id="addform"  style="position: relative;">
			
			<div class="formgroup">
				<label class="formlabel">{lang parent_category:admin}:</label>
				<div class="formcontrol">
					<div class="input-prepend" id="popcategory" style="margin-left: 2px;">
						<input id="parent_id" name="parent_id" type="hidden" class="select_id">
						<input id="parent_name" name="parent_name" type="hidden" class="select_title">
						<a href="javascript:void(0);" class="btn category-popbutton"><span class="select_title">{lang tip_plsselect}</span> <span class="caret ml10"></span></a>
					</div>
				</div>
				<span class="formhelp">{lang parent_category_tip:admin}</span>
			</div>
			
			<div class="formgroup">
				<label class="formlabel">{lang category_name_cn:admin}:</label>
				<div class="formcontrol">
					<input type="text" name="category_name_cn" id="category_name_cn"/>
				</div>
				<span class="formhelp">{lang category_name_cn_tip:admin}</span>
			</div>
			
			<div class="formgroup">
				<label class="formlabel">{lang category_name_en:admin}:</label>
				<div class="formcontrol">
					<input type="text" name="category_name_en" id="category_name_en"/>
				</div>
				<span class="formhelp">{lang category_name_en_tip:admin}</span>
			</div>
			
			<div class="formgroup">
				<label class="formlabel">{lang th_displayorder:admin}:</label>
				<div class="formcontrol">
					<input type="text" name="display_order" id="display_order"/>
				</div>
				<span class="formhelp">{lang th_displayorder:admin}</span>
			</div>
			
			<div class="formgroup">
				<label class="formlabel">{lang category_is_open:admin}:</label>
				<div class="formcontrol">
					<input type="radio" name="is_open" value="1" checked>{lang yes:admin}</input>
              		<input type="radio" name="is_open" value="0">{lang no:admin}</input>
				</div>
				<span class="formhelp">{lang category_is_open_tip:admin}</span>
			</div> 
			
			
			<div class="formgroup">
				<label class="formlabel">{lang category_is_home:admin}:</label>
				<div class="formcontrol">
					<input type="radio" name="is_home" value="1" checked>{lang yes:admin}</input>
              		<input type="radio" name="is_home" value="0">{lang no:admin}</input>
				</div>
				<span class="formhelp">{lang category_is_home_tip:admin}</span>
			</div> 
			<div class="formgroup">
				<label class="formlabel">{lang category_hot_words:admin}:</label>
				<div class="formcontrol">
					<textarea type="text" id="category_hot_words" name="category_hot_words" rows="3"></textarea>
				</div>
				<span class="formhelp">{lang category_hot_words_tip:admin}</span>
			</div>
			
			<div class="formbuttons">
				<button type="submit" class="btn btn-primary">{lang add:admin}</button>
			</div>
		</form>
	</div>
</div>
<script type="text/javascript">
//http://www.onightjar.com/topics/category/news/feed
$(document).ready(function () {
	$('#parent_id').change(function (){ 
		$("#parent_name").val($('#parent_id option:selected').attr('data-name'));
	});
	$('.category-popbutton').popcategory({
		top: '65px',
		left: '10px',
		targetid: 'popcategory',
		showRoot: true,
		tpl: 'deepcategory'});
});
</script>
{template common/contentfooter}